# frozen_string_literal: true

class GitcodeRepo < GitcodeBase
  def self.index_name
    'gitcode-repo_raw'
  end

  def self.mapping
    {"dynamic"=>"true",
     "dynamic_templates"=>
     [{"notanalyzed"=>{"match"=>"*", "match_mapping_type"=>"string", "mapping"=>{"type"=>"keyword"}}},
      {"formatdate"=>{"match"=>"*", "match_mapping_type"=>"date", "mapping"=>{"format"=>"strict_date_optional_time||epoch_millis", "type"=>"date"}}}],
     "properties"=>
     {"backend_name"=>{"type"=>"keyword"},
      "backend_version"=>{"type"=>"keyword"},
      "category"=>{"type"=>"keyword"},
      "data"=>
      {"properties"=>
       {"allow_forking"=>{"type"=>"boolean"},
        "archive_url"=>{"type"=>"keyword"},
        "archived"=>{"type"=>"boolean"},
        "archivedAt"=>{"type"=>"date"},
        "assignees_url"=>{"type"=>"keyword"},
        "blobs_url"=>{"type"=>"keyword"},
        "body"=>{"type"=>"text"},
        "branches_url"=>{"type"=>"keyword"},
        "clone_url"=>{"type"=>"keyword"},
        "collaborators_url"=>{"type"=>"keyword"},
        "comments_data"=>{"dynamic"=>"false", "properties"=>{"body"=>{"type"=>"text"}}},
        "comments_url"=>{"type"=>"keyword"},
        "commits_url"=>{"type"=>"keyword"},
        "compare_url"=>{"type"=>"keyword"},
        "contents_url"=>{"type"=>"keyword"},
        "contributors_url"=>{"type"=>"keyword"},
        "created_at"=>{"type"=>"date"},
        "default_branch"=>{"type"=>"keyword"},
        "deployments_url"=>{"type"=>"keyword"},
        "description"=>{"type"=>"keyword"},
        "disabled"=>{"type"=>"boolean"},
        "downloads_url"=>{"type"=>"keyword"},
        "events_url"=>{"type"=>"keyword"},
        "fetched_on"=>{"type"=>"float"},
        "fork"=>{"type"=>"boolean"},
        "forks"=>{"type"=>"long"},
        "forks_count"=>{"type"=>"long"},
        "forks_url"=>{"type"=>"keyword"},
        "full_name"=>{"type"=>"keyword"},
        "git_commits_url"=>{"type"=>"keyword"},
        "git_refs_url"=>{"type"=>"keyword"},
        "git_tags_url"=>{"type"=>"keyword"},
        "git_url"=>{"type"=>"keyword"},
        "has_discussions"=>{"type"=>"boolean"},
        "has_downloads"=>{"type"=>"boolean"},
        "has_issues"=>{"type"=>"boolean"},
        "has_pages"=>{"type"=>"boolean"},
        "has_projects"=>{"type"=>"boolean"},
        "has_wiki"=>{"type"=>"boolean"},
        "homepage"=>{"type"=>"keyword"},
        "hooks_url"=>{"type"=>"keyword"},
        "html_url"=>{"type"=>"keyword"},
        "id"=>{"type"=>"long"},
        "is_template"=>{"type"=>"boolean"},
        "issue_comment_url"=>{"type"=>"keyword"},
        "issue_events_url"=>{"type"=>"keyword"},
        "issues_url"=>{"type"=>"keyword"},
        "keys_url"=>{"type"=>"keyword"},
        "labels_url"=>{"type"=>"keyword"},
        "language"=>{"type"=>"keyword"},
        "languages_url"=>{"type"=>"keyword"},
        "license"=>
        {"properties"=>
         {"key"=>{"type"=>"keyword"},
          "name"=>{"type"=>"keyword"},
          "node_id"=>{"type"=>"keyword"},
          "spdx_id"=>{"type"=>"keyword"},
          "url"=>{"type"=>"keyword"}}},
        "merges_url"=>{"type"=>"keyword"},
        "milestones_url"=>{"type"=>"keyword"},
        "mirror_url"=>{"type"=>"keyword"},
        "name"=>{"type"=>"keyword"},
        "network_count"=>{"type"=>"long"},
        "node_id"=>{"type"=>"keyword"},
        "notifications_url"=>{"type"=>"keyword"},
        "open_issues"=>{"type"=>"long"},
        "open_issues_count"=>{"type"=>"long"},
        "organization"=>
        {"properties"=>
         {"avatar_url"=>{"type"=>"keyword"},
          "events_url"=>{"type"=>"keyword"},
          "followers_url"=>{"type"=>"keyword"},
          "following_url"=>{"type"=>"keyword"},
          "gists_url"=>{"type"=>"keyword"},
          "gravatar_id"=>{"type"=>"keyword"},
          "html_url"=>{"type"=>"keyword"},
          "id"=>{"type"=>"long"},
          "login"=>{"type"=>"keyword"},
          "node_id"=>{"type"=>"keyword"},
          "organizations_url"=>{"type"=>"keyword"},
          "received_events_url"=>{"type"=>"keyword"},
          "repos_url"=>{"type"=>"keyword"},
          "site_admin"=>{"type"=>"boolean"},
          "starred_url"=>{"type"=>"keyword"},
          "subscriptions_url"=>{"type"=>"keyword"},
          "type"=>{"type"=>"keyword"},
          "url"=>{"type"=>"keyword"}}},
        "owner"=>
        {"properties"=>
         {"avatar_url"=>{"type"=>"keyword"},
          "events_url"=>{"type"=>"keyword"},
          "followers_url"=>{"type"=>"keyword"},
          "following_url"=>{"type"=>"keyword"},
          "gists_url"=>{"type"=>"keyword"},
          "gravatar_id"=>{"type"=>"keyword"},
          "html_url"=>{"type"=>"keyword"},
          "id"=>{"type"=>"long"},
          "login"=>{"type"=>"keyword"},
          "node_id"=>{"type"=>"keyword"},
          "organizations_url"=>{"type"=>"keyword"},
          "received_events_url"=>{"type"=>"keyword"},
          "repos_url"=>{"type"=>"keyword"},
          "site_admin"=>{"type"=>"boolean"},
          "starred_url"=>{"type"=>"keyword"},
          "subscriptions_url"=>{"type"=>"keyword"},
          "type"=>{"type"=>"keyword"},
          "url"=>{"type"=>"keyword"}}},
        "parent"=>
        {"properties"=>
         {"allow_forking"=>{"type"=>"boolean"},
          "archive_url"=>{"type"=>"keyword"},
          "archived"=>{"type"=>"boolean"},
          "assignees_url"=>{"type"=>"keyword"},
          "blobs_url"=>{"type"=>"keyword"},
          "branches_url"=>{"type"=>"keyword"},
          "clone_url"=>{"type"=>"keyword"},
          "collaborators_url"=>{"type"=>"keyword"},
          "comments_url"=>{"type"=>"keyword"},
          "commits_url"=>{"type"=>"keyword"},
          "compare_url"=>{"type"=>"keyword"},
          "contents_url"=>{"type"=>"keyword"},
          "contributors_url"=>{"type"=>"keyword"},
          "created_at"=>{"type"=>"date"},
          "default_branch"=>{"type"=>"keyword"},
          "deployments_url"=>{"type"=>"keyword"},
          "description"=>{"type"=>"keyword"},
          "disabled"=>{"type"=>"boolean"},
          "downloads_url"=>{"type"=>"keyword"},
          "events_url"=>{"type"=>"keyword"},
          "fork"=>{"type"=>"boolean"},
          "forks"=>{"type"=>"long"},
          "forks_count"=>{"type"=>"long"},
          "forks_url"=>{"type"=>"keyword"},
          "full_name"=>{"type"=>"keyword"},
          "git_commits_url"=>{"type"=>"keyword"},
          "git_refs_url"=>{"type"=>"keyword"},
          "git_tags_url"=>{"type"=>"keyword"},
          "git_url"=>{"type"=>"keyword"},
          "has_discussions"=>{"type"=>"boolean"},
          "has_downloads"=>{"type"=>"boolean"},
          "has_issues"=>{"type"=>"boolean"},
          "has_pages"=>{"type"=>"boolean"},
          "has_projects"=>{"type"=>"boolean"},
          "has_wiki"=>{"type"=>"boolean"},
          "homepage"=>{"type"=>"keyword"},
          "hooks_url"=>{"type"=>"keyword"},
          "html_url"=>{"type"=>"keyword"},
          "id"=>{"type"=>"long"},
          "is_template"=>{"type"=>"boolean"},
          "issue_comment_url"=>{"type"=>"keyword"},
          "issue_events_url"=>{"type"=>"keyword"},
          "issues_url"=>{"type"=>"keyword"},
          "keys_url"=>{"type"=>"keyword"},
          "labels_url"=>{"type"=>"keyword"},
          "language"=>{"type"=>"keyword"},
          "languages_url"=>{"type"=>"keyword"},
          "license"=>
          {"properties"=>
           {"key"=>{"type"=>"keyword"},
            "name"=>{"type"=>"keyword"},
            "node_id"=>{"type"=>"keyword"},
            "spdx_id"=>{"type"=>"keyword"},
            "url"=>{"type"=>"keyword"}}},
          "merges_url"=>{"type"=>"keyword"},
          "milestones_url"=>{"type"=>"keyword"},
          "mirror_url"=>{"type"=>"keyword"},
          "name"=>{"type"=>"keyword"},
          "node_id"=>{"type"=>"keyword"},
          "notifications_url"=>{"type"=>"keyword"},
          "open_issues"=>{"type"=>"long"},
          "open_issues_count"=>{"type"=>"long"},
          "owner"=>
          {"properties"=>
           {"avatar_url"=>{"type"=>"keyword"},
            "events_url"=>{"type"=>"keyword"},
            "followers_url"=>{"type"=>"keyword"},
            "following_url"=>{"type"=>"keyword"},
            "gists_url"=>{"type"=>"keyword"},
            "gravatar_id"=>{"type"=>"keyword"},
            "html_url"=>{"type"=>"keyword"},
            "id"=>{"type"=>"long"},
            "login"=>{"type"=>"keyword"},
            "node_id"=>{"type"=>"keyword"},
            "organizations_url"=>{"type"=>"keyword"},
            "received_events_url"=>{"type"=>"keyword"},
            "repos_url"=>{"type"=>"keyword"},
            "site_admin"=>{"type"=>"boolean"},
            "starred_url"=>{"type"=>"keyword"},
            "subscriptions_url"=>{"type"=>"keyword"},
            "type"=>{"type"=>"keyword"},
            "url"=>{"type"=>"keyword"}}},
          "private"=>{"type"=>"boolean"},
          "pulls_url"=>{"type"=>"keyword"},
          "pushed_at"=>{"type"=>"date"},
          "releases_url"=>{"type"=>"keyword"},
          "size"=>{"type"=>"long"},
          "ssh_url"=>{"type"=>"keyword"},
          "stargazers_count"=>{"type"=>"long"},
          "stargazers_url"=>{"type"=>"keyword"},
          "statuses_url"=>{"type"=>"keyword"},
          "subscribers_url"=>{"type"=>"keyword"},
          "subscription_url"=>{"type"=>"keyword"},
          "svn_url"=>{"type"=>"keyword"},
          "tags_url"=>{"type"=>"keyword"},
          "teams_url"=>{"type"=>"keyword"},
          "topics"=>{"type"=>"keyword"},
          "trees_url"=>{"type"=>"keyword"},
          "updated_at"=>{"type"=>"date"},
          "url"=>{"type"=>"keyword"},
          "visibility"=>{"type"=>"keyword"},
          "watchers"=>{"type"=>"long"},
          "watchers_count"=>{"type"=>"long"},
          "web_commit_signoff_required"=>{"type"=>"boolean"}}},
        "permissions"=>
        {"properties"=>
         {"admin"=>{"type"=>"boolean"},
          "maintain"=>{"type"=>"boolean"},
          "pull"=>{"type"=>"boolean"},
          "push"=>{"type"=>"boolean"},
          "triage"=>{"type"=>"boolean"}}},
        "private"=>{"type"=>"boolean"},
        "pulls_url"=>{"type"=>"keyword"},
        "pushed_at"=>{"type"=>"date"},
        "releases"=>{"dynamic"=>"false", "properties"=>{"body"=>{"type"=>"text"}}},
        "releases_url"=>{"type"=>"keyword"},
        "review_comments_data"=>{"dynamic"=>"false", "properties"=>{"body"=>{"type"=>"text"}, "diff_hunk"=>{"type"=>"text"}}},
        "reviews_data"=>{"dynamic"=>"false", "properties"=>{"body"=>{"type"=>"text"}}},
        "size"=>{"type"=>"long"},
        "source"=>
        {"properties"=>
         {"allow_forking"=>{"type"=>"boolean"},
          "archive_url"=>{"type"=>"keyword"},
          "archived"=>{"type"=>"boolean"},
          "assignees_url"=>{"type"=>"keyword"},
          "blobs_url"=>{"type"=>"keyword"},
          "branches_url"=>{"type"=>"keyword"},
          "clone_url"=>{"type"=>"keyword"},
          "collaborators_url"=>{"type"=>"keyword"},
          "comments_url"=>{"type"=>"keyword"},
          "commits_url"=>{"type"=>"keyword"},
          "compare_url"=>{"type"=>"keyword"},
          "contents_url"=>{"type"=>"keyword"},
          "contributors_url"=>{"type"=>"keyword"},
          "created_at"=>{"type"=>"date"},
          "default_branch"=>{"type"=>"keyword"},
          "deployments_url"=>{"type"=>"keyword"},
          "description"=>{"type"=>"keyword"},
          "disabled"=>{"type"=>"boolean"},
          "downloads_url"=>{"type"=>"keyword"},
          "events_url"=>{"type"=>"keyword"},
          "fork"=>{"type"=>"boolean"},
          "forks"=>{"type"=>"long"},
          "forks_count"=>{"type"=>"long"},
          "forks_url"=>{"type"=>"keyword"},
          "full_name"=>{"type"=>"keyword"},
          "git_commits_url"=>{"type"=>"keyword"},
          "git_refs_url"=>{"type"=>"keyword"},
          "git_tags_url"=>{"type"=>"keyword"},
          "git_url"=>{"type"=>"keyword"},
          "has_discussions"=>{"type"=>"boolean"},
          "has_downloads"=>{"type"=>"boolean"},
          "has_issues"=>{"type"=>"boolean"},
          "has_pages"=>{"type"=>"boolean"},
          "has_projects"=>{"type"=>"boolean"},
          "has_wiki"=>{"type"=>"boolean"},
          "homepage"=>{"type"=>"keyword"},
          "hooks_url"=>{"type"=>"keyword"},
          "html_url"=>{"type"=>"keyword"},
          "id"=>{"type"=>"long"},
          "is_template"=>{"type"=>"boolean"},
          "issue_comment_url"=>{"type"=>"keyword"},
          "issue_events_url"=>{"type"=>"keyword"},
          "issues_url"=>{"type"=>"keyword"},
          "keys_url"=>{"type"=>"keyword"},
          "labels_url"=>{"type"=>"keyword"},
          "language"=>{"type"=>"keyword"},
          "languages_url"=>{"type"=>"keyword"},
          "license"=>
          {"properties"=>
           {"key"=>{"type"=>"keyword"},
            "name"=>{"type"=>"keyword"},
            "node_id"=>{"type"=>"keyword"},
            "spdx_id"=>{"type"=>"keyword"},
            "url"=>{"type"=>"keyword"}}},
          "merges_url"=>{"type"=>"keyword"},
          "milestones_url"=>{"type"=>"keyword"},
          "mirror_url"=>{"type"=>"keyword"},
          "name"=>{"type"=>"keyword"},
          "node_id"=>{"type"=>"keyword"},
          "notifications_url"=>{"type"=>"keyword"},
          "open_issues"=>{"type"=>"long"},
          "open_issues_count"=>{"type"=>"long"},
          "owner"=>
          {"properties"=>
           {"avatar_url"=>{"type"=>"keyword"},
            "events_url"=>{"type"=>"keyword"},
            "followers_url"=>{"type"=>"keyword"},
            "following_url"=>{"type"=>"keyword"},
            "gists_url"=>{"type"=>"keyword"},
            "gravatar_id"=>{"type"=>"keyword"},
            "html_url"=>{"type"=>"keyword"},
            "id"=>{"type"=>"long"},
            "login"=>{"type"=>"keyword"},
            "node_id"=>{"type"=>"keyword"},
            "organizations_url"=>{"type"=>"keyword"},
            "received_events_url"=>{"type"=>"keyword"},
            "repos_url"=>{"type"=>"keyword"},
            "site_admin"=>{"type"=>"boolean"},
            "starred_url"=>{"type"=>"keyword"},
            "subscriptions_url"=>{"type"=>"keyword"},
            "type"=>{"type"=>"keyword"},
            "url"=>{"type"=>"keyword"}}},
          "private"=>{"type"=>"boolean"},
          "pulls_url"=>{"type"=>"keyword"},
          "pushed_at"=>{"type"=>"date"},
          "releases_url"=>{"type"=>"keyword"},
          "size"=>{"type"=>"long"},
          "ssh_url"=>{"type"=>"keyword"},
          "stargazers_count"=>{"type"=>"long"},
          "stargazers_url"=>{"type"=>"keyword"},
          "statuses_url"=>{"type"=>"keyword"},
          "subscribers_url"=>{"type"=>"keyword"},
          "subscription_url"=>{"type"=>"keyword"},
          "svn_url"=>{"type"=>"keyword"},
          "tags_url"=>{"type"=>"keyword"},
          "teams_url"=>{"type"=>"keyword"},
          "topics"=>{"type"=>"keyword"},
          "trees_url"=>{"type"=>"keyword"},
          "updated_at"=>{"type"=>"date"},
          "url"=>{"type"=>"keyword"},
          "visibility"=>{"type"=>"keyword"},
          "watchers"=>{"type"=>"long"},
          "watchers_count"=>{"type"=>"long"},
          "web_commit_signoff_required"=>{"type"=>"boolean"}}},
        "ssh_url"=>{"type"=>"keyword"},
        "stargazers_count"=>{"type"=>"long"},
        "stargazers_url"=>{"type"=>"keyword"},
        "statuses_url"=>{"type"=>"keyword"},
        "subscribers_count"=>{"type"=>"long"},
        "subscribers_url"=>{"type"=>"keyword"},
        "subscription_url"=>{"type"=>"keyword"},
        "svn_url"=>{"type"=>"keyword"},
        "tags_url"=>{"type"=>"keyword"},
        "teams_url"=>{"type"=>"keyword"},
        "temp_clone_token"=>{"type"=>"keyword"},
        "template_repository"=>
        {"properties"=>
         {"allow_forking"=>{"type"=>"boolean"},
          "archive_url"=>{"type"=>"keyword"},
          "archived"=>{"type"=>"boolean"},
          "assignees_url"=>{"type"=>"keyword"},
          "blobs_url"=>{"type"=>"keyword"},
          "branches_url"=>{"type"=>"keyword"},
          "clone_url"=>{"type"=>"keyword"},
          "collaborators_url"=>{"type"=>"keyword"},
          "comments_url"=>{"type"=>"keyword"},
          "commits_url"=>{"type"=>"keyword"},
          "compare_url"=>{"type"=>"keyword"},
          "contents_url"=>{"type"=>"keyword"},
          "contributors_url"=>{"type"=>"keyword"},
          "created_at"=>{"type"=>"date"},
          "default_branch"=>{"type"=>"keyword"},
          "deployments_url"=>{"type"=>"keyword"},
          "description"=>{"type"=>"keyword"},
          "disabled"=>{"type"=>"boolean"},
          "downloads_url"=>{"type"=>"keyword"},
          "events_url"=>{"type"=>"keyword"},
          "fork"=>{"type"=>"boolean"},
          "forks"=>{"type"=>"long"},
          "forks_count"=>{"type"=>"long"},
          "forks_url"=>{"type"=>"keyword"},
          "full_name"=>{"type"=>"keyword"},
          "git_commits_url"=>{"type"=>"keyword"},
          "git_refs_url"=>{"type"=>"keyword"},
          "git_tags_url"=>{"type"=>"keyword"},
          "git_url"=>{"type"=>"keyword"},
          "has_discussions"=>{"type"=>"boolean"},
          "has_downloads"=>{"type"=>"boolean"},
          "has_issues"=>{"type"=>"boolean"},
          "has_pages"=>{"type"=>"boolean"},
          "has_projects"=>{"type"=>"boolean"},
          "has_wiki"=>{"type"=>"boolean"},
          "homepage"=>{"type"=>"keyword"},
          "hooks_url"=>{"type"=>"keyword"},
          "html_url"=>{"type"=>"keyword"},
          "id"=>{"type"=>"long"},
          "is_template"=>{"type"=>"boolean"},
          "issue_comment_url"=>{"type"=>"keyword"},
          "issue_events_url"=>{"type"=>"keyword"},
          "issues_url"=>{"type"=>"keyword"},
          "keys_url"=>{"type"=>"keyword"},
          "labels_url"=>{"type"=>"keyword"},
          "language"=>{"type"=>"keyword"},
          "languages_url"=>{"type"=>"keyword"},
          "license"=>
          {"properties"=>
           {"key"=>{"type"=>"keyword"},
            "name"=>{"type"=>"keyword"},
            "node_id"=>{"type"=>"keyword"},
            "spdx_id"=>{"type"=>"keyword"},
            "url"=>{"type"=>"keyword"}}},
          "merges_url"=>{"type"=>"keyword"},
          "milestones_url"=>{"type"=>"keyword"},
          "name"=>{"type"=>"keyword"},
          "node_id"=>{"type"=>"keyword"},
          "notifications_url"=>{"type"=>"keyword"},
          "open_issues"=>{"type"=>"long"},
          "open_issues_count"=>{"type"=>"long"},
          "owner"=>
          {"properties"=>
           {"avatar_url"=>{"type"=>"keyword"},
            "events_url"=>{"type"=>"keyword"},
            "followers_url"=>{"type"=>"keyword"},
            "following_url"=>{"type"=>"keyword"},
            "gists_url"=>{"type"=>"keyword"},
            "gravatar_id"=>{"type"=>"keyword"},
            "html_url"=>{"type"=>"keyword"},
            "id"=>{"type"=>"long"},
            "login"=>{"type"=>"keyword"},
            "node_id"=>{"type"=>"keyword"},
            "organizations_url"=>{"type"=>"keyword"},
            "received_events_url"=>{"type"=>"keyword"},
            "repos_url"=>{"type"=>"keyword"},
            "site_admin"=>{"type"=>"boolean"},
            "starred_url"=>{"type"=>"keyword"},
            "subscriptions_url"=>{"type"=>"keyword"},
            "type"=>{"type"=>"keyword"},
            "url"=>{"type"=>"keyword"}}},
          "permissions"=>
          {"properties"=>
           {"admin"=>{"type"=>"boolean"},
            "maintain"=>{"type"=>"boolean"},
            "pull"=>{"type"=>"boolean"},
            "push"=>{"type"=>"boolean"},
            "triage"=>{"type"=>"boolean"}}},
          "private"=>{"type"=>"boolean"},
          "pulls_url"=>{"type"=>"keyword"},
          "pushed_at"=>{"type"=>"date"},
          "releases_url"=>{"type"=>"keyword"},
          "size"=>{"type"=>"long"},
          "ssh_url"=>{"type"=>"keyword"},
          "stargazers_count"=>{"type"=>"long"},
          "stargazers_url"=>{"type"=>"keyword"},
          "statuses_url"=>{"type"=>"keyword"},
          "subscribers_url"=>{"type"=>"keyword"},
          "subscription_url"=>{"type"=>"keyword"},
          "svn_url"=>{"type"=>"keyword"},
          "tags_url"=>{"type"=>"keyword"},
          "teams_url"=>{"type"=>"keyword"},
          "temp_clone_token"=>{"type"=>"keyword"},
          "topics"=>{"type"=>"keyword"},
          "trees_url"=>{"type"=>"keyword"},
          "updated_at"=>{"type"=>"date"},
          "url"=>{"type"=>"keyword"},
          "visibility"=>{"type"=>"keyword"},
          "watchers"=>{"type"=>"long"},
          "watchers_count"=>{"type"=>"long"},
          "web_commit_signoff_required"=>{"type"=>"boolean"}}},
        "topics"=>{"type"=>"keyword"},
        "trees_url"=>{"type"=>"keyword"},
        "updated_at"=>{"type"=>"date"},
        "url"=>{"type"=>"keyword"},
        "visibility"=>{"type"=>"keyword"},
        "watchers"=>{"type"=>"long"},
        "watchers_count"=>{"type"=>"long"},
        "web_commit_signoff_required"=>{"type"=>"boolean"}}},
      "metadata__timestamp"=>{"type"=>"date"},
      "metadata__updated_on"=>{"type"=>"date"},
      "origin"=>{"type"=>"keyword"},
      "perceval_version"=>{"type"=>"keyword"},
      "search_fields"=>{"properties"=>{"item_id"=>{"type"=>"keyword"}, "owner"=>{"type"=>"keyword"}, "repo"=>{"type"=>"keyword"}}},
      "tag"=>{"type"=>"keyword"},
      "timestamp"=>{"type"=>"float"},
      "updated_on"=>{"type"=>"float"},
      "uuid"=>{"type"=>"keyword"}}}
  end

  def self.only(origins)
    self
      .where(origin: origins)
      .custom(collapse: { field: :origin })
      .source([
                'origin',
                'backend_name',
                'data.name',
                'data.language',
                'data.full_name',
                'data.forks_count',
                'data.watchers_count',
                'data.stargazers_count',
                'data.open_issues_count',
                'data.created_at',
                'data.updated_at'])
      .execute
      .raw_response
  end

  def self.trends(limit: 24)
    self
      .exists(:origin)
      .custom(collapse: { field: :origin })
      .sort('data.updated_at': 'desc').page(1).per(limit)
      .source([
                'origin',
                'backend_name',
                'data.name',
                'data.language',
                'data.full_name',
                'data.forks_count',
                'data.subscribers_count',
                'data.stargazers_count',
                'data.open_issues_count',
                'data.created_at',
                'data.updated_at'])
      .execute
      .raw_response
  end
end
